package com.witfortos.kotlindemo.common.adp

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.witfortos.kotlindemo.R
import com.witfortos.kotlindemo.mvvm.data.News

/**
 *   @auther : tan
 *   time   : 2020-07-10
 */
class NewsAdp : BaseQuickAdapter<News, BaseViewHolder>(R.layout.rv_news_item) {

    override fun convert(helper: BaseViewHolder, item: News) {
        helper.setText(R.id.title, item.title)
                .setText(R.id.time, item.time);
        val imageView = helper.getView<ImageView>(R.id.cover);
        Glide.with(imageView).load(item.image).into(imageView)
    }
}